#ifndef PAGETESTCONFIG_H
#define PAGETESTCONFIG_H

#include    <QtCore>
#include    <QtGui>
#include    <QFrame>

class configPage : public QFrame
{
    Q_OBJECT

public:
    configPage(QWidget *parent = 0);

    QComboBox *cboMacAddr;
    QPushButton *btnRefresh;
    QLineEdit *inputDelay;
    QRadioButton *btnInstrument;

    //int channelMapping[6];
    int sync_flag;

    int voltageStdIndex;
    int voltageStdUnitIndex;
    double voltageSmall;

    int currentStdIndex;
    double currentSmall;

    double voltagePre;
    double currentPre;

    int dutIndex;
    QString macAddr;

    void loadCfg();

    void getsendUdp_mut(char * ch,int flag);
    int getUdpMutLen() {return sizeof(MUT_Send);}
private:
    QLabel *labDelay;
    QLabel *labDelayUnit;

    QRadioButton *btnSync1;
    QRadioButton *btnSync2;
    QRadioButton *btnSync3;
    QRadioButton *btnSync4;
    QRadioButton *btnSync5;
    QRadioButton *btnSync6;
    QRadioButton *btnSync7;

    QLineEdit *inputVoltagePre;
    QComboBox *cboVoltageUnit;
    QComboBox *cboVoltageStd;

    QLineEdit *inputVoltageSmall ;
    QLabel *labVoltageSmall ;

    QLineEdit *inputCurrentPre;
    QComboBox *cboCurrentStd;

    QLineEdit *inputCurrentSmall;
    QLabel *labCurrentSmall;

    QComboBox *cboDut;

    QLabel *labMac;

    QRadioButton *btnProtect;

    QComboBox *cboChannelUa;
    QComboBox *cboChannelUb;
    QComboBox *cboChannelUc;
    QComboBox *cboChannelIa;
    QComboBox *cboChannelIb;
    QComboBox *cboChannelIc;

    void updateChannelMapping();

    typedef struct _MUT_Send
    {
        char    de_name[6];
        char	udp_type;   /* 与_ETC_Send兼容，避开0x30,0x31,'!','#','*'. 使用'a','b','c'等 */
        char	tbfs;       /*同步方式  0,同步输出；1,电秒脉冲；2,光秒脉冲3,B码电信号；4,B码光信号；5,50Hz倍频；非同步*/
        char	ycdy;       /*一次电压  0-100，1-100√V */
        char    ycdl;       /*一次电流  0-1A, 1-5A     */
//        float	xdyz;       /*小电压值  如果标准选择为4或者5，则有数，否则用0填充*/
        char    bcxz;       /*被测选择  0-9-2, 1-FT3*/
        char    tdlb[6];    /*通道列表 9-2时不使用，FT3时按Ua，Ub，Uc，Ia，Ib，Ic顺序给出通道号*/
        char    ex[20];
    }MUT_Send;

public slots:
    void showDelay();
    void configDone();
    void showVSmall();
    void showISmall();
    void showDutCfg();

signals:
    void cfgDone();
};

#endif // PAGETESTCONFIG_H
